package cn.fan.vertd.utils;

import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.kafka.client.consumer.KafkaConsumer;
import io.vertx.kafka.client.producer.KafkaProducer;

public class TunerKafka {

    private KafkaConsumer<String, String> consumer;

    private KafkaProducer<String, String> producer;

    public static final String TEST_GROUP_ID = "testGroup001";

    public static final String TEST_TOPIC = "test_001";

    public void createConsumer(Vertx vertx, JsonObject config, String groupId) {
        this.consumer = new KafkaUtil(vertx, config, groupId).getConsumer();
    }

    public void createProducer(Vertx vertx, JsonObject config) {
        this.producer = new KafkaUtil(vertx, config).getProducer();
    }

    public KafkaConsumer<String, String> getConsumer() {
        return consumer;
    }

    public KafkaProducer<String, String> getProducer() {
        return producer;
    }
}
